/*
 * client_remote_master.h
 *
 *  Created on: Dec 22, 2012
 *      Author: redchen
 */

#ifndef CLIENT_REMOTE_MASTER_H_
#define CLIENT_REMOTE_MASTER_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <list.h>

typedef struct _remote_master_ RemoteMaster;

RemoteMaster* remote_master_init(const char* master_addr, int32_t port);

void remote_master_destory(RemoteMaster* master);

Status remote_master_file_create(RemoteMaster* master, const char* name_space, int32_t min_replica, int32_t max_replica);

/**
 * Only include data size ,not include meta size
 */
int32_t remote_master_chunk_data_max_size(RemoteMaster* master);

/**
 * Split data to many chunk by CHUNK MAX SIZE
 */
Status remote_master_chunk_list_by_size(RemoteMaster* master, int64_t size, /*out*/List* mchunk_list);

/**
 * Delete file meta from master
 */
Status remote_master_delete(RemoteMaster* master, const char* name_space);

#ifdef __cplusplus
}
#endif

#endif /* CLIENT_REMOTE_MASTER_H_ */
